package org.yenn.pattern.observer.weather5;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: yerenyun
 * @Description:
 */
public abstract class WeatherSubject {

    //用来保存注册的观察者对象
    public List<Observer> observers = new ArrayList<>();
    //attach detach notifyobservers
    /*//把订阅天气的人观察者添加到订阅者列表中*/
    void attach(Observer observer){
        observers.add(observer);
    }
    //删除集合中指定的订阅天气的人
    void  detach(Observer observer){
        observers.remove(observer);
    }
    protected abstract void  notifyObservers();
}
